import axios from './index'
const preUrl = ''

const egg = {
  getEggSmashList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/lucky`, {
        params
      })
    }
  },
  // 未使用次数修改
  editUnusedSmash: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/luckyupdate`, params)
    }
  },
  getEggSmashDetail: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/detail`, {
        params
      })
    }
  },
}


const bonus = {
  getBonusRecordList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/reward`, {
        params
      })
    }
  },
  getBonusRecordDetail: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/rewarddetail`, {
        params
      })
    }
  },
  // 发奖设置列表
  getBonusManageList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/rewardlist`, {
        params
      })
    }
  },
  saveBonusTypeConfig: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/relationupdate`, params)
    }
  },
  getBonusAmountList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/relationlist`, {
        params
      })
    }
  },
  editBonusAmountList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/updatereward`, params)
    }
  },
}

const card = {
  // 获取卡片列表
  getCardDetailList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/card`, {
        params
      })
    }
  },
  // 修改卡片数量
  editCardAmount: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/cardupdate`, params)
    }
  },
  getCardPresentList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/cardgiving`, {
        params
      })
    }
  },
  getCardRecordList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/cardchange`, {
        params
      })
    }
  }
}

/* 红包管理 */
const redpacket = {
  // 获取玩家申请兑换红包列表
  getApplyRedeemList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/redapply/`, {
        params
      })
    }
  },
  // 标记为已发货
  getMarkedAsRedeemed: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/redupdate`, params)
    }
  },
  // 获取玩家申请兑换红包列表
  getRedpacketRecord: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/redrecord`, {
        params
      })
    }
  },
  // 跳转+玩家红包详情
  getPlayerRedpacketDetail: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/reddetail/`, {
        params
      })
    }
  }
}

/* 兑奖管理 */
const redeem = {
  // 获取玩家申请兑列表
  getRedeemList: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/ticket`, {
        params
      })
    }
  },
  // 标记为已发货
  getMarkedAsRedeemed: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.put(`${preUrl}/activity/${Cookie.get('areaCode')}/ticketupdate`, params)
    }
  },
  getPlayersInActivity: {
    p: [`get,/newproxy/*/*`],
    r: params => {
      axios.defaults.headers.permission = `get,/newproxy/*/*`
      return axios.get(`${preUrl}/activity/${Cookie.get('areaCode')}/totallist`, {
        params
      })
    }
  },
  
}

export {
  egg,
  bonus,
  card,
  redpacket,
  redeem
}